<template>
  <div class="wrapper">
    <swiper ref="mySwiper" :options="swiperOptions" v-if="swiper">
      <swiper-slide v-for="item of list" :key="item.id">
        <img class="swiper-img" :src="imgBaseURL + item.imgUrl" />
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>
<script>
/* eslint-disable */
export default {
  name: "HomeSwiper",
  props: {
    list: Array,
  },
  data() {
    return {
      swiperOptions: {
        pagination: {
          el: ".swiper-pagination",
        },
        loop: true,
        // Some Swiper option/callback...
      },
      imgBaseURL: process.env.BASE_API,
    };
  },
  computed: {
    swiper() {
      return this.list.length;
    },
  },
  mounted() {
    console.log("Current Swiper instance object", this.swiper);
    // this.swiper.slideTo(1, 1000, false);
  },
};
</script>

<style scoped>
.wrapper {
  overflow: hidden;
  width: 100%;
  height: 0;
  padding-bottom: 31.25%;
  background: #eee;
}
.swiper-img {
  width: 100%;
}
</style>
